cmake_minimum_required(VERSION 3.19)
project(ChatTcpClient LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)


find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets NetWork)

qt_standard_project_setup()

qt_add_executable(ChatTcpClient
    WIN32 MACOSX_BUNDLE
    main.cpp
    mainwindow.cpp
    mainwindow.h
    mainwindow.ui
    qtcp_client.h
    qtcp_client.cpp
    qstorage.h
    qstorage.cpp
)

target_link_libraries(ChatTcpClient
    PRIVATE
        Qt::Core
        Qt::Widgets
        Qt::Network
)

include(GNUInstallDirs)

install(TARGETS ChatTcpClient
    BUNDLE  DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

qt_generate_deploy_app_script(
    TARGET ChatTcpClient
    OUTPUT_SCRIPT deploy_script
    NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
